#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main()
{
	vector<int> v;
	/*make_heap(v.begin(), v.end(), less<int>());
	int ans = 0;
	float sum = 0, summid = 0;
	for (auto x : v)
		sum += x;
	summid = sum / 2;
	while(1)
	{
		sum = 0;
		float hp = v[0];
		pop_heap(v.begin(), v.end(), less<int>());
		v.pop_back();

		v.push_back(hp / 2);
		make_heap(v.begin(), v.end(), less<int>());
		ans++;

		for (auto x : v)
			sum += x;

		if (sum <= summid)
			break;
	}*/

	priority_queue<double> d;
	int ans = 0;
	float sum = 0, summid = 0;
	for (auto x : v)
		sum += x, d.push(x);
	summid = sum / 2;
	while (1)
	{
		sum -= d.top();
		float hp = d.top();
		d.pop();

		d.push(hp / 2);
		ans++;

		sum += hp / 2;

		if (sum <= summid)
			break;
	}


	return 0;
}